Setting up JavaScript You can add JavaScripts to your document page. You can also insert JavaScripts in the head section of your document window to allow a script to be executed while the visible section of the document is still being loaded. After you have inserted an icon in the body or head of your Web page, you create the JavaScript in the JavaScript Editor. To set up a JavaScript: 1 Drag the JavaScript icon from the Basic tab ( ![]() A. JavaScript icon B. Script icon
2 Select the JavaScript icon in the document window, or select the Script icon in the head section pane. 3 In the Inspector, type in a descriptive name in the Name text box. 4 Choose a target browser from the Language pop-up menu. The language version corresponding to your browser selection appears in the text box below the menu. 5 To reference an existing script, select Source and type in a resource locator for your script file, click the Browse button to select a script, or drag from the Point and Shoot button to link to a script in the site window. Script files must have the .js extension. To edit an existing JavaScript: 1 To open the JavaScript Editor, do one of the following: ![]() 2 If the icons on the JavaScript Editor toolbar are inactive, click New Script Item ( 3 Click the Events tab of the JavaScript Inspector to see the objects that can have events attached and the events they support. To add an event to your script, select the event in the Inspector, and type the event code in the Event Code text box. ![]() Create event definitions by typing the event codes in the Event Code text box.
4 Click the Objects tab of the JavaScript Inspector to display the complete inventory of JavaScript objects. To add an object to your script, drag it from the Objects tab to the JavaScript Editor window.
5 Close the JavaScript Editor to save your work. 6 Click Show in Browser on the Adobe GoLive toolbar to open your Web page in the browser you selected for previewing and testing in the Preferences dialog box. Or choose Special > Show in Default Browser. Note: In Mac OS, you cannot preview the effects of a JavaScript in Preview mode. The following sample JavaScript code shows how to use a simple JavaScript to display the time and date obtained from the viewer's operating system. ![]() JavaScript sample
Adding Interactivity > Using JavaScript > Setting up JavaScript |